package com.inspur.demo.controller;

import com.inspur.demo.common.CommResultMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.client.RestTemplate;

/**
 *    
 *
 * @desc:
 * @author: li.peng02
 * @date: 2019/3/14
 * @version: v1.0 
 */
@Controller
public class RibbonController {

    @Autowired
    @LoadBalanced
    private RestTemplate balanceRestTemplate;

    @RequestMapping("/ribbon/balance/test")
    public ResponseEntity<CommResultMsg> test01() {
        return balanceRestTemplate.getForEntity("http://spring-cloud-producer/producer/test?name=123", CommResultMsg.class);
    }
}
